<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <eForm ref="form" :sup_this="sup_this" />
    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :data="data.rtnList"
      :max-height="gridMaxHeight"
      :total="total"
      :show-page="false"
      grid-id="detailMemberMngProcessGridId"
      @selection-change="handleGridSelectionChange">
      <DataGridColumnSlot prop="userId" label="成员">
        <template slot-scope="scope">
          <edit :data="scope.row" :sup_this="sup_this" />
        </template>
      </DataGridColumnSlot>
      <DataGridColumnSlot prop="memberRole" label="团队角色">
        <template slot-scope="scope">
          <template v-for="item in dicts.custom_member_role">
            <span v-if="scope.row.memberRole == item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <!--  <DataGridColumn slot="memberPriv" prop="memberPriv" label="成员权限, 对应数据字典 custom_member_role" />-->
      <DataGridColumn prop="memberRatio" label="提成比例">
        <template slot="header">
          提成比例<IconHelp display-content="合计100%" />
        </template>
      </DataGridColumn>
      <DataGridColumnSlot prop="lastUpdateDate" label="最后更新时间" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdateDate) }}</span>
        </template>
      </DataGridColumnSlot>
    </DataGridTable>
  </div>
</template>

<script>
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import edit from './module/edit'
import eForm from './module/form'
import initData from '@/mixins/initData'
import detailMember from '@/api/crm/DetailMember'

export default {
  dictTypes: ['custom_member_role'],
  components: { eHeader, eForm, edit },
  mixins: [initData],
  props: {
  },
  data() {
    return {
      delLoading: false,
      sup_this: this,
      busMainData: {}
    }
  },
  created() {
    this.url = detailMember.loadDataUrl()
    /* this.$nextTick(() => {
      this.resetQuery(true)
    }) */
  },
  mounted() {
  },
  methods: {
    parseTime,
    async beforeInit() {
      return true
    },
    initLoadDataByCode(busMainData) {
      this.busMainData = busMainData
      this.defaultParamBean.objectSysCode = busMainData.sysGenCode
      this.resetQuery(true)
    }
  }
}
</script>
